#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 5015;
const int MX = 5005;

int n, m;
int a[N], b, c[N];

void init(string& s, int a[N]) {
  for (int i = 0, j = s.size() - 1; i < s.size(); i++, j--) a[i] = s[j] - '0';
}
void divide(int a[N], int b, int c[N]) {
  ll val = 0;
  per(i, MX, 0) {
    val = val * 10 + a[i];
    c[i] = val / b;
    val %= b;
  }
}
void output(int a[N]) {
  int h = MX;
  while (h > 0 && !a[h]) h--;
  per(i, h, 0) cout << a[i];
}

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  string s;
  cin >> s >> b;
  init(s, a);
  divide(a, b, c);
  output(c);
  return 0;
}